libherokubuildpack: Fix colour resetting for the log_*
macros
#890
+50
−25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes some long-standing ANSI colour bugs with the
log_header
,log_error
andlog_warning
macros.Whilst we soon want to move away to more advanced logging libraries that use the new logging style, there are still many buildpacks using these macros which will benefit short term from these fixes (Procfile, Go, Node.js, JVM, Python, PHP, buildpacks-release-phase, buildpacks-frontend-web).
The logging macros would previously emit output roughly like:
This was not only missing the final
<reset>
, but also didn't wrap each line individually with colour codes/resets.This causes issues when lines end up prefixed - such as the Git
remote:
prefix, or when using Pack CLI locally with an untrusted build (which adds the colourised[builder]
prefixes) or--timestamps
mode.For example in this:
...several of the
remote:
s would inherit the colours.Instead what we need is:
Fixes #555.
Closes #844.
GUS-W-17400078.